package com.tentact.web1216.servlets;



import com.tentact.web1216.service.StudentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "DelDepaByIdServlet", value = "/DelDepaByIdServlet")
public class DelDepaByIdServlet extends HttpServlet {
    StudentService service=new StudentService();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        if (request.getParameter("id")!=null){
            int id=Integer.parseInt(request.getParameter("id"));
            service.deleteById(id);
            response.sendRedirect("StudentView.jsp");
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
